package com.example.emailWeb.Socket.Proxy;

import java.util.Comparator;

public class PrimaryKey {
    public String fileName;
    public String fileOwnerEmail, fileRequesterEmail;
    public int keyOrder;
    public String info;

    public PrimaryKey(PolySocketData polySocketData) {
        this.fileName = polySocketData.fileName;
        this.fileOwnerEmail = polySocketData.fileOwnerEmail;
        this.fileRequesterEmail = polySocketData.fileRequesterEmail;
        this.keyOrder = polySocketData.keyOrder;
        forInfo();
    }

    public PrimaryKey(String fileOwnerEmail, String fileRequesterEmail, int keyOrder, String fileName) {
        this.fileName = fileName;
        this.fileOwnerEmail = fileOwnerEmail;
        this.fileRequesterEmail = fileRequesterEmail;
        this.keyOrder = keyOrder;
        forInfo();
    }

    public void forInfo() {
        info = fileRequesterEmail + "中" + fileOwnerEmail + "中" + keyOrder + "中" + fileName;
    }

    @Override
    public String toString() {
        return "PrimaryKey{" +
                "fileOwnerEmail='" + fileOwnerEmail + '\'' +
                ", fileRequesterEmail='" + fileRequesterEmail + '\'' +
                ", keyOrder=" + keyOrder +
                '}';
    }
}
